#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QHostAddress>
#include <QMessageBox>
#include <QCheckBox>
#include <QDateTime>
#include <QLayout>
#include <QPushButton>
#include "privatedialog.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
signals:
    void havePm(QString);

private:
    Ui::MainWindow *ui;
    QTcpSocket *client;
    QMap<QString,bool> recv;
    QMap<QString,PrivateDialog*> pdMap;
    QMap<QString,QHBoxLayout*> layMap;
    QMap<QString,QCheckBox*> checkMap;
    QMap<QString,QPushButton*> pushMap;
private slots:
    void add_user(QString,quint16,QString);
    void readServer();
    void recvError(QAbstractSocket::SocketError);
    void on_send_clicked();
    void on_clean_clicked();
    void recvChanged(int);
    void openPrivate();

};

#endif // MAINWINDOW_H
